package com.itlong.cloud.operate.resource;

import com.itlong.cloud.POJO.DTO.operate.OperateAssignmentManageDTO;
import com.itlong.cloud.POJO.VO.operate.OperateAssignmentDetailVO;
import com.itlong.cloud.POJO.VO.operate.OperateAssignmentPageVO;
import com.itlong.cloud.operate.service.IOperateAssignmentManageService;
import com.itlong.cloud.paymenthub.IOperateAssignmentManageServiceClient;
import com.itlong.cloud.utils.page.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <desc>
 *      任务书管理服务接口包暴露实现类
 * </desc>
 *
 * @createDate2020/11/30
 **/
@RestController
public class OperateAssignmentManageServiceResource implements IOperateAssignmentManageServiceClient {

    @Autowired
    private IOperateAssignmentManageService iOperateAssignmentManageService;


    /**
     * <desc>
     *      获取详情
     * </desc>
     *
     * @param operateAssignmentManageDTO 运营任务书管理DTO
     * @return
     * @Author Zhu.yj
     * @createDate  2020/11/30
     */
    @Override
    @PostMapping("/operate/finance/assignment/getDetail")
    public OperateAssignmentDetailVO getDetail(@RequestBody OperateAssignmentManageDTO operateAssignmentManageDTO) throws Exception {
        return iOperateAssignmentManageService.getDetail(operateAssignmentManageDTO);
    }

    /**
     * <desc>
     *      分页获取任务书列表
     * </desc>
     *
     * @param operateAssignmentManageDTO 运营任务书管理DTO
     * @return 任务书分页数据
     * @Author Zhu.yj
     * @createDate  2020/12/1
     */
    @Override
    @PostMapping("/operate/finance/assignment/getPage")
    public Page<OperateAssignmentPageVO> getPage(@RequestBody OperateAssignmentManageDTO operateAssignmentManageDTO) throws Exception {
        return iOperateAssignmentManageService.getPage(operateAssignmentManageDTO);
    }

    /**
     * <desc>
     *      创建云服务费首三年订单
     * </desc>
     *
     * @Author Zhu.yj
     * @createDate  2020/12/2
     */
    @PostMapping("/timetask/operate/createCloudServiceCostOrderTimeTask")
    @Override
    public boolean createCloudServiceCostOrderTimeTask(@RequestParam("firstSync") String firstSync) throws Exception{
        return iOperateAssignmentManageService.createCloudServiceCostOrderTimeTask(firstSync);
    }

    /**
     * <desc>
     *      手动同步任务书
     * </desc>
     *
     * @param operateAssignmentManageDTO 运营任务书管理DTO
     * @return
     * @Author Zhu.yj
     * @createDate  2020/12/17
     */
    @Override
    @PostMapping("/operate/finance/assignment/assignmentSync")
    public Integer assignmentSync(@RequestBody OperateAssignmentManageDTO operateAssignmentManageDTO) throws Exception {
        return iOperateAssignmentManageService.assignmentSync(operateAssignmentManageDTO);
    }
}
